package com.yidu.BusinessData.service.impl;


import com.yidu.BusinessData.entity.BondEntity;
import com.yidu.BusinessData.mapper.BondMapper;
import com.yidu.BusinessData.service.BondService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class BondServiceImlp implements BondService {

    @Autowired
    private BondMapper bondMapper;

    public List<BondEntity> bondSelect(String bondName,int page, int limit) {
        Map map =new HashMap();
        map.put("bondName",bondName);
        map.put("page",(page-1)*limit);
        map.put("limit",limit);
        return bondMapper.bondSelect(map);
    }

    /*public String buildWhere(String bondName){
        StringBuffer strWhere=new StringBuffer();
        if(bondName!=null && !bondName.equals("")){
            strWhere.append(" and bondName like '%" + bondName + "%'" );
        }
        return strWhere.toString();
    }*/

    public int bondSelectCount() {
        return bondMapper.bondSelectCount();
    }

    @Override
    public void bondInsert(BondEntity bond) {
        bondMapper.bongInsert(bond);
    }

    @Override
    public void bondUpdate(BondEntity bond) {
        bondMapper.bondUpdate(bond);
    }

    @Override
    public void bondDelete(String bondId) {
        bondMapper.bondDelete(bondId);
    }

    @Override
    public BondEntity selectBond(String bondId) {
        return bondMapper.selectBond(bondId);
    }

}
